home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef CONSULTATION_C
- #define CONSULTATION_C
- /*
- ** $Filename: Consultation.c $
- ** $Revision: 1.2 $
- ** $Release: 2.2 $
- ** $Date: 92/09/16 $
- **
- **
- ** (C) Copyright 1992 David Scrève
- ** All Rights Reserved
- */
-
- #include <dos/dosextens.h>
-
- #include "structures.h"
- #include "EXVariables_globales.h"
-
- /* Prototypes */
-
- BOOL SmallForbid();
- struct programme consultation();
- LONG nombremprunts();
- BOOL nouveau();
-
- /* Code C */
-
- BOOL nouveau(abcs)
- LONG abcs;
- {
- LONG indicelue;
- BOOL resultat=FALSE;
-
- nouveautes=(struct FileHandle *)Open(&news_nom[0],MODE_READWRITE);
- if (nouveautes!=NULL)
- {
- do
- retour=Read(nouveautes,&indicelue,sizeof(indicelue));
- while ( retour>>0 && indicelue!=abcs);
- resultat=(indicelue==abcs);
- Close(nouveautes);
- }
- return (resultat);
- }
-
- LONG nombremprunts(indic)
- LONG indic;
- {
- LONG nb_emp=-1;
- LONG RealIndic;
-
- RealIndic=(indic/(LONG)sizeof(struct programme));
- RealIndic*=sizeof(nb_emp);
-
- emprunts=(struct FileHandle *)Open(&emprunts_nom[0],MODE_READWRITE);
- if (emprunts!=NULL)
- {
- retour=Seek(emprunts,RealIndic,OFFSET_BEGINNING);
- retour=Read(emprunts,&nb_emp,sizeof(nb_emp));
- Close(emprunts);
- }
- if (retour<=0)
- nb_emp=-1;
- return(nb_emp);
- }
-
- struct programme consultation(indi)
- LONG indi;
- {
- struct programme prgtmp;
-
- retour=-1;
- prgtmp.nom[0]=0;
- prog=(struct FileHandle *)Open(&prog_nom[0],MODE_READWRITE);
- if (prog!=NULL)
- {
- retour=Seek(prog,indi,OFFSET_BEGINNING);
- retour=Read(prog,&prgtmp,sizeof(struct programme));
- Close(prog);
- }
- if (retour==0 || retour==-1)
- {
- prgtmp.nom[0]=0;
-
- /* New for Release 2.2 : compatible with older use but return now the */
- /* number of the error occured */
-
- if (retour==NULL)
- prgtmp.taille=EOF_REACHED;
- else
- prgtmp.taille=IoErr();
- }
- return(prgtmp);
- }
-
- BOOL SmallForbid(abcs)
- LONG abcs;
- {
- LONG indicelue;
- BOOL resultat=FALSE;
-
- progX=(struct FileHandle *)Open(&progX_nom[0],MODE_READWRITE);
- if (progX!=NULL)
- {
- do
- retour=Read(progX,&indicelue,sizeof(indicelue));
- while ( retour>>0 && indicelue!=abcs);
- resultat=(indicelue==abcs);
- Close(progX);
- }
- return (resultat);
- }
-
- #endif /* CONSULTATION_C */